package com.mindskip.gushuang.controller;

import com.mindskip.gushuang.base.RestResponse;
import com.mindskip.gushuang.domain.AddressBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 孤霜
 * @version 1.0
 */
@Controller
@ResponseBody
public class updateAddressController {

    @Autowired
    private AddressBean addressBean;

    @GetMapping("/updateAddress")
    public RestResponse updateAddress(@RequestParam(value = "address", required = true) String address, @RequestParam(value = "key", required = true) String key) {
        if("ajkjvosdifnmsdvmosidrvjaovjoviijvoidfvjdovj56449498sdcacvs4vs4vf1sv8d4v1dv41d".equals(key)){
            addressBean.setAddress(address);
            System.out.println(addressBean.getAddress());
        }else{
            return  RestResponse.ok("更新失败");
        }
        return  RestResponse.ok("更新完毕 "+addressBean.getAddress());
    }
}
